package com.lagou.controller;

import com.lagou.service.EmailService;
import com.lagou.util.ResponseData;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/email")
public class EmailController {
    @Autowired
    private EmailService emailService;

    /**
     * 发送验证码到邮箱
     */
    @PostMapping("/sendCode")
    public ResponseData sendCodeToEmail(String code,String email){
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        emailService.sendCodeTOEmail(code,email);
        return ResponseData.success("发送成功");
    }
}
